﻿using Artech.Common;
using Artech.Core.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace Artech.Core.Globalization.Configuration
{
    public class GlobalizationSettings : ServiceLocatableConfigurationSection
    {
        private const string PropertyName4ConvertTimeToUtc = "convertTimeToUtc";

        [ConfigurationProperty(PropertyName4ConvertTimeToUtc, IsRequired = false, DefaultValue = false)]
        public bool DateTimeKind
        {
            get { return (bool)base[PropertyName4ConvertTimeToUtc]; }
            set { base[PropertyName4ConvertTimeToUtc] = value; }
        }

        public static GlobalizationSettings GetSettings()
        {
            return ConfigurationSourceManager.Current.GetConfigurationSection<GlobalizationSettings>(Constants.ConfigurationSections.Globalization)
                ?? new GlobalizationSettings();
        }
    }
}
